<?php


namespace App\Controller\App;


use App\Base\BaseController4App;
use App\Entity\User;
use App\Repository\BannerRepository;
use App\Repository\MoneyLogRepository;
use App\Repository\MoneyRepository;
use App\Repository\SalesCutRepository;
use App\Repository\SalesUserJuanRepository;
use App\Repository\SiteOilCategoryRepository;
use App\Repository\SiteRepository;
use App\Repository\UserRepository;
use App\Service\MoneyService;
use Symfony\Component\Routing\Annotation\Route;

/**
 * @Route("/app/money")
 */
class AppMoneyController extends BaseController4App
{
    /**
     * @Route("/log", name="AppMoneyLog")
     */
    public function AppMoneyLog(
        MoneyLogRepository $moneyLogRepository
    )
    {
        $user = $this->needToBeUser();
        $req = $this->getRequestData();
        $page = $req["page"]??1;
        $data = $moneyLogRepository->findBy(array("user"=>$user,"moneyType.id"=>2),array("id"=>"DESC"),10,$page * 10 - 10);

//        $this->setGroups("user","app","juan");
        return $this->json_out(1,"OK",$data);
    }


}